package com.duoduo.${serviceName}.api.entity;

import java.io.Serializable;
import java.time.LocalDateTime;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
@EntityListeners(AuditingEntityListener.class)
public class ${entityType} implements Serializable {

	@Id
	<#if fieldOne==true >
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    <#else>
    </#if>
     <#list fields as field >
     /**
	 * ${field.explain}
	 */
	<#if field.fieldName == "createTime" >
    @CreatedDate
    </#if>
    <#if field.fieldName == "updateTime" >
    @LastModifiedDate
    </#if>
    <#if field.fieldName == "createBy" >
    @CreatedBy
    </#if>
    <#if field.fieldName == "updateBy" >
    @LastModifiedBy
    </#if>        
	private ${field.fieldType} ${field.fieldName};
	</#list>

}
